﻿@model IEnumerable<TCC.CMFlow.Models.PerfilAcesso>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<!-- modal placeholder-->
<div id='myModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='myModalContent'></div>
        </div>
    </div>
</div>

<div class="panel panel-info" style="margin-top: 15px">
    <div class="panel-heading clearfix">

        <h3 class="panel-title pull-left"><strong>Perfis de Acesso</strong></h3>
        <div class="btn-group pull-right">
            <a class="btn btn-primary btn-sm" href="@Url.Action("Create")" id="btnCreate" data-modal=""><span class="glyphicon glyphicon-plus"></span> Novo Perfil</a>
        </div>

    </div>
    <div class="panel-body">

        @using (Html.BeginForm())
        {
            @Html.AntiForgeryToken()
            
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="form-inline">
                        <div class="form-group">
                            @Html.Label("Código")
                            @Html.TextBox("codigo", null, new { @class = "search-control", style = "width:75px;" })
                        </div>

                        <div class="form-group">
                            @Html.Label("Nome")
                            @Html.TextBox("nome", null, new { @class = "search-control", style = "width:150px;" })
                        </div>

                        <div class="form-group">
                            @Html.Label("Status")
                            @Html.DropDownList("PerfilStatus", ViewBag.UserStatus as SelectList, "Todos", new { @class = "chzn-select", style = "width:75px;" })
                        </div>
                    </div>
                </div>
                <div class="panel-footer clearfix">
                    <div class="pull-right">
                        <input type="submit" value="Pesquisar" class="btn btn-primary btn-sm" />
                        <input type="reset" value="Limpar campos" class="btn btn-default btn-sm" />
                    </div>
                </div>
            </div>
        }

        <table class="table table-striped table-bordered">
            <tr>
                <th>
                    @Html.DisplayNameFor(model => model.ID)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Nome)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.InicioVigencia)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.FimVigencia)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Status)
                </th>
                <th>
                    Ação
                </th>
            </tr>

            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.ID)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Nome)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.InicioVigencia)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.FimVigencia)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Status)
                    </td>
                    <td>
                        <a data-modal="" class="btn" href="@Url.Action("Edit", new { id = item.ID })" id="btnEdit"><span class="glyphicon glyphicon-pencil"></span></a>
                        <a href="@Url.Action("Details", new { id = item.ID })" id="btnDetails"><span class="glyphicon glyphicon-search"></span></a>
                        <a data-modal="" class="btn" href="@Url.Action("Inactivate", new { id = item.ID })" id="btnDelete"><span class="glyphicon glyphicon-remove"></span></a>
                    </td>
                </tr>
            }

        </table>
    </div>
</div>

<script src="/TCC.CMFlow/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/chosen.jquery.js" type="text/javascript"></script>
<script> $(".chzn-select").chosen(); </script>
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/modalform")
}
